package gui;

import boardgame.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

public abstract class GListener implements ActionListener, ItemListener {
	
	protected BoardGUI gui = null;
	protected GameState board = null;
	
	public GListener(){
		
	}
	
	public GListener(BoardGUI gui, GameState board){
		this.gui = gui;
		this.board = board;
	}
	
	public void actionPerformed(ActionEvent arg0) {		
		updateGUI(arg0, updateModel(arg0));
	}

	public void itemStateChanged(ItemEvent arg0) {		
		updateGUI(arg0, updateModel(arg0));
	}

	protected abstract String updateModel(ActionEvent e);
	protected abstract void updateGUI(ActionEvent e, String error);
	protected abstract String updateModel(ItemEvent e);
	protected abstract void updateGUI(ItemEvent e, String error);
}
